<%@ page import="com.bean.User" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>用户列表</title>
</head>
<%
    List<User> onlineUsers = (List<User>) request.getServletContext().getAttribute("onlineUsers");
%>
<body>
<a href="./user.do?action=logout">注销</a>
<table border="1px" cellpadding="0" cellspacing="0" width="500px">
    <tr>
        <td>用户名</td>
        <td>IP地址</td>
        <td>登录时间</td>
        <td>操作</td>
    </tr>
    <%
        if (onlineUsers != null) {
            for (int i = 0; i < onlineUsers.size(); i++) {
                User user = onlineUsers.get(i);
    %>
    <tr>
        <td><%=user.getUsername()%>
        </td>
        <td><%=user.getIp()%>
        </td>
        <td><%=user.getLoginTime()%>
        </td>
        <td><a href="./user.do?action=kick&username=<%=user.getUsername()%>">踢人</a></td>
    </tr>
    <%
            }
        }
    %>
</table>
</body>
</html>
